﻿namespace EggOfPanKu.Main
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;

    /// <summary>
    /// Interaction logic for LoadDeck.xaml
    /// </summary>
    public partial class LoadDeck : Window
    {
        #region Constructors

        public LoadDeck()
        {
            InitializeComponent();
        }

        #endregion Constructors

        #region Delegates

        //Delegate used to bubble BtnSubmit event up to the page
        public delegate void DeckSubmitHandler(object sender, RoutedEventArgs e);

        #endregion Delegates

        #region Events

        //Event used to instantiate the delegate, and call it
        public event DeckSubmitHandler SubmitDeck;

        #endregion Events

        #region Methods

        public void BtnSubmit_Click(object sender, RoutedEventArgs e)
        {
            SubmitDeck(this, e);
            this.Close();
        }

        private void BtnBrowse_Click(object sender, RoutedEventArgs e)
        {
            //Open OpenFileDialog
            Microsoft.Win32.OpenFileDialog openFile = new Microsoft.Win32.OpenFileDialog();
            openFile.DefaultExt = ".l5d";
            openFile.Filter = "L5R Decks (.l5d)|*.l5d";

            //Load Selected .L5D file
            bool? result = openFile.ShowDialog();
            if (result == true)
            {
                //FileInfo fi = new FileInfo(openFile.FileName);
                TxtDeckPath.Text = openFile.FileName;
            }
        }

        private void BtnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        #endregion Methods
    }
}